/*
 * @Description: 异常日志
 * @Author: xinqiao lxq1990.0716@qq.com
 * @Date: 2024-06-28
 * @LastEditors: xinqiao lxq1990.0716@qq.com
 * @LastEditTime: 2024-07-01
 */
import * as Sentry from '@sentry/vue'
import type { App } from 'vue'

export const setupSentry = (app: App<Element>, router) => {
  if (import.meta.env.VITE_SENTRY_COLLECT !== 'true') return
  Sentry.init({
    app,
    dsn: import.meta.env.VITE_SENTRY_DSN,
    integrations: [Sentry.browserTracingIntegration({ router }), Sentry.replayIntegration()],
    environment: import.meta.env.VITE_ENV,
    tracesSampleRate: 1.0,
    logErrors: true,
    //tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
    //replaysSessionSampleRate: 0.1,
    //replaysOnErrorSampleRate: 1.0,
  })
}

/*
//linkai
Sentry.init({
  Vue,
  dsn: 'xxxxxxxxxxxxxxx'
  autoSessionTracking: true,
  integrations: [
    new Integrations.BrowserTracing()
  ],
  environment: process.env.VUE_APP_ENV || 'dev',
  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control
  tracesSampleRate: 1.0,
  logErrors: true,
  initialScope: (scope) => {
    // console.log('scope', scope);
    const phoneNumber = store.state.user.phoneNumber;
    const userName = store.state.user.userName;
    const departmentName = store.state.user.departmentName;
    scope.setTags({ userName, phoneNumber, departmentName });
    // scope.setUser({ username: userName, phoneNumber });
    return scope;
  }
*/
